#pragma once
#include <memory>
#include "MemoryPool.h"
#include "LockFreeRingBuffer.h"
#include "Receiver.h"
#include "Sender.h"
// #include "RateMonitor.h"


class OrderServer
{
public:
    OrderServer(const char *listen_ip, uint16_t listen_port,
                const char *target_ip, uint16_t target_port,
                int recv_cpu_id, int send_cpu_id);

    ~OrderServer();

    void start();
    void stop();

private:
    std::unique_ptr<MemoryPool> memoryPool_;
    std::unique_ptr<LockFreeRingBuffer<OrderPacket>> ringBuffer_;
    std::unique_ptr<Receiver> receiver_;
    std::unique_ptr<Sender> sender_;
    // std::unique_ptr<RateMonitor> rateMonitor_;


    const char *listen_ip_;
    uint16_t listen_port_;
    const char *target_ip_;
    uint16_t target_port_;
    int recv_cpu_id_;
    int send_cpu_id_;
};
